<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script>

    function removeAreaElement() {
        document.getElementById("test").innerHTML=1
    }

    function queryTitleOnDecendants(accessibilityObject) {
        accessibilityObject.name

        var count = accessibilityObject.childrenCount;
        for (var i = 0; i < count; ++i)
            queryTitleOnDecendants(accessibilityObject.childAtIndex(i));
    }
</script>
<script src="../resources/js-test.js"></script>
</head>
<body>

<img usemap="#map">
<map name="map" id="test"><area href="javascript:document.getElementById('result').innerHTML='area clicked'" /></map>

<p id="description"></p>
<div id="console"></div>

<script>
    description("Requesting the title of an AccessibilityImageMapLink can cause a crash when the map's area element has been removed.");

    if (window.accessibilityController) {
        // First build up full accessibility tree.
        document.body.focus();
        queryTitleOnDecendants(accessibilityController.focusedElement);
        
        removeAreaElement()
        
        // Now call request the title for each accessibility object.
        document.body.focus();
        queryTitleOnDecendants(accessibilityController.focusedElement);
    }

</script>

</body>
</html>
